﻿//======================================================================
//
//	Cross-Platform XNA Menu System
//  http://cpxms.codeplex.com/
//
//  All code and content licensed under Microsoft Public License (Ms-PL)	
//
//======================================================================
//
//	File:		Image.cs
//
//	Author:		MJP
//
//	Date:		04/27/09
//
//======================================================================

using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using System.ComponentModel;
using System.Collections.ObjectModel;
using System.Xml.Serialization;
using System.Drawing.Design;

using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;


namespace CPXMenu
{
	/// <summary>
	/// A simple static image 
	/// </summary>
    [CanHaveChildren(false)]
    [IconKey("Image")]
    [Selectable(true)]
    [Movable(true)]
    [Sizeable(true)]
    [CanCopyPaste(true)]
    [Description("A simple static image")]
    public class Image : MenuItem
    {
        private ImageState imageState = new ImageState();

		/// <summary>
		/// Gets or sets the ImageState representing the appearance of the Image
		/// </summary>
        [Browsable(true)]
        [Category("Appearance")]
        [Description("Controls the appearance of the Image")]
        public ImageState ImageState
        {
            get { return imageState; }
            set
            {
                imageState = value;
                ImageStates.Clear();
                ImageStates.Add(imageState);
            }
        }

        /// <summary>
        /// Creates a clone of the item
        /// </summary>
        /// <returns>A clone of the item</returns>
        public override MenuItem Clone()
        {
            Image clone = (Image)base.Clone();

            clone.imageState = this.imageState.Clone();
            clone.ImageStates.Add(clone.imageState);

            return clone;
        }

		/// <summary>
		/// Creates a new instance of Image
		/// </summary>
        public Image()
            : base()
        {
            Dimensions = new Point(100, 100);

            ImageState = imageState;
            ImageStateIndex = 0;
        }
    }
}